﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using RapChieuPhim.DTO;
using RapChieuPhim.BUS;
using DevExpress.XtraEditors;

namespace RapChieuPhim.GUI
{
    public partial class Profile : UserControl
    {
        public Profile()
        {
            InitializeComponent();
        }

        public NhanVienDTO nv = Modules.Login.user.NhanVien;

        private void Profile_Load(object sender, EventArgs e)
        {
            txtHoTen.Text = nv.HoTen;
            txtDiaChi.Text = nv.DiaChi;
            txtCMND.Text = nv.CMND;
            txtDienThoai.Text = nv.DienThoai;
            cbxGioiTinh.SelectedIndex = nv.GioiTinh == true ? 0 : 1;
            dtNgaySinh.EditValue = nv.NgaySinh;
        }

        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            nv.HoTen = txtHoTen.Text;
            nv.DiaChi = txtDiaChi.Text;
            nv.CMND = txtCMND.Text;
            nv.DienThoai = txtDienThoai.Text;
            nv.GioiTinh = cbxGioiTinh.SelectedIndex == 0 ? true : false;
            nv.NgaySinh = (DateTime)dtNgaySinh.EditValue;


            NhanVienBUS.Update(nv);
            XtraMessageBox.Show("Cập nhật thông tin cá nhân thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            
        }
    }
}
